<?php

// comment out the following two lines when deployed to production
//defined('YII_DEBUG') or define('YII_DEBUG', true);
//defined('YII_ENV') or define('YII_ENV', 'dev');
ini_set("error_reporting","E_ALL & ~E_NOTICE");
$isPro = '';
$isPro = file_exists(__DIR__ . '/../env-pro.php');
$isDev = file_exists(__DIR__ . '/../env-dev.php');
$isPre = file_exists(__DIR__ . '/../env-pre.php');
if($isPro){
    define('ENV_CONFIG','prod');
}elseif($isDev){
    define('ENV_CONFIG','dev');
}elseif($isPre){
    define('ENV_CONFIG','pre');
}

defined('ENV_CONFIG') or define('ENV_CONFIG','prod');

if(ENV_CONFIG == 'dev' || ENV_CONFIG  == 'pre'){
    defined('YII_DEBUG') or define('YII_DEBUG', true);
    defined('YII_ENV') or define('YII_ENV', 'dev');
}


require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';

require(__DIR__ . '/../common/config/bootstrap.php');
require(__DIR__ . '/../config/bootstrap.php');


$config = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/../common/config/main-'.ENV_CONFIG.'.php'),
    require(__DIR__ . '/../config/main-'.ENV_CONFIG.'.php')
);
//向容器注册接口
require(__DIR__ .'/reg.php');

//$config = require __DIR__ . '/../config/web.php';
//print_r($config);exit;
//(new yii\web\Application($config))->run();
$application = new yii\web\Application($config);
$application->run();
